package fun.cyhgraph.controller.merchant;

import fun.cyhgraph.annotation.AuthCheck;
import fun.cyhgraph.model.dto.UserDTO;
import fun.cyhgraph.model.dto.UserLoginWechatDTO;
import fun.cyhgraph.model.entity.User;
import fun.cyhgraph.result.Result;
import fun.cyhgraph.service.UserService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/merchant")
@Tag(name = "商家管理")
@Slf4j
public class MerchantController {

    @Resource
    private UserService userService;

    @Operation(summary = "商家登录")
    @PostMapping("/login")
    public Result<Object> login(@RequestBody UserLoginWechatDTO userLoginWechatDTO){
        Result<Object> objectResult = userService.wxLoginForMerchant(userLoginWechatDTO);
        return objectResult;
    }
//
//    /**
//     * 根据id查询用户
//     * @return
//     */
//    @Operation(summary = "根据id查询用户")
//    @GetMapping("/{id}")
//    public Result<User> getUser(@PathVariable Integer id){
//
//        User user = userService.getUser(id);
//        return Result.success(user);
//    }

//    /**
//     * 修改用户信息
//     * @param userDTO
//     * @return
//     */
//    @PutMapping
//    public Result update(@RequestBody UserDTO userDTO){
//        log.info("新的用户信息：{}", userDTO);
//        userService.update(userDTO);
//        return Result.success();
//    }

}
